import * as api from './util';

// -----------------------------------------------------table
// 餐桌类别列表
export function getProductType(data) {
  return api.get('/app/pedestal/type/list', data);
}

// 新增餐桌类别
export function addType(data) {
  return api.post('/app/pedestal/type', data);
}

// 根据餐桌类别详情
export function detailType(id) {
  return api.get(`/app/pedestal/type/${id}`);
}

// 修改餐桌类别
export function editType(id, data) {
  return api.put(`/app/pedestal/type/${id}`, data);
}

// 删除餐桌类别
export function deleteType(id) {
  return api.delet(`/app/pedestal/type/${id}`);
}

// 新增餐桌
export function addCommodity(data) {
  return api.post('/app/pedestal', data);
}

// 餐桌列表
export function getCommodity(data) {
  return api.get('/app/pedestal/list', data);
}

// 餐桌详情
export function getCommodityDetail(id) {
  return api.get(`/app/pedestal/${id}`);
}

// 删除餐桌
export function deleteCommodity(id) {
  return api.delet(`/app/pedestal/${id}`);
}

// 修改餐桌
export function editCommodity(id, data) {
  return api.put(`/app/pedestal/${id}`, data);
}

// 生产code
export function eqCode(id, data) {
  return api.post(`/app/pedestal/code/${id}`, data);
}
























export function getHomeData() {
  return api.get('/applets/provider/homeData/get');
}

export function getShareData(companyId) {
  let postbody = { companyId: companyId };
  return api.get('/applets/provider/shareData/get', postbody);
}

export function getTradeData(companyId) {
  let postbody = { companyId: companyId };
  return api.get('/applets/provider/tradingData/get', postbody);
}

export function getMyCompanies() {
  let postbody = { pageNo: 1, pageSize: 999 }
  return api.get('/applets/provider/userCompany/getMyCompanys', postbody);
}

export function switchCompany(companyId) {
  let postbody = { companyId: companyId };
  return api.get('/applets/provider/userCompany/switchMyCompany', postbody);
}

export function updateSwitchInfo() {
  return api.get('/applets/provider/customUser/info');
}

export function getPromptMsgs() {
  return api.post('/applets/provider/message/promptArea');
}

export function getMsgs(pageNo, pageSize) {
  let postbody = { pageNo, pageSize };
  return api.post('/applets/provider/message/list', postbody);
}

export function getUnReadMsg() {
  return api.get('/applets/provider/message/countMsg');
}

export function markAsRead() {
  return api.post('/applets/provider/message/allSignAsRead');
}

export function markAsReadOne(postbody) {
  return api.post('/applets/message/sign', postbody);
}

export function delMsg(postbody) {
  return api.get('/applets/delMsg', postbody);
}

// 交易数据统计
export function getTradingDataSta(recentDay) {
  return api.get('/applets/provider/tradingData/get', { recentDay: recentDay });
}

// 分享数据统计
export function getShareDataSta(recentDay) {
  return api.get('/applets/provider/shareData/get', { recentDay: recentDay });
}